<?php
    if(!isset($ingredient_title) || !isset($ingredient_id)){
        $ingredient_title = "";
        $ingredient_id = -1;
    }
?>
<input type="hidden" id="ingredient_id" value="<?=$ingredient_id?>"/>
<b><?=$type?></b>

<div id="ingredient_name_section" class="form_section">
    <div class="title">Ingredient Name: <span class="subtitle">(required)</span></div>
<input type="text" id="ingredient_title" class="input_field" value="<?=$ingredient_title?>"/>
    <div class="warning_section"></div>
</div>

<div id="basetype_section" class="form_section">
    <div class="title">Ingredient Requirements: <span class="subtitle">(required)</span></div>

    <select id="input_basetype">
        <option value="-1">- Select Basetypes -</option>
        <?foreach($basetypes->result() as $result):?>
        <option value="<?=$result->basetype_id?>"><?=$result->basetype_title?></option>
        <?endforeach;?>
    </select>

    <div id="basetype_list" class="listbox">
        <? if(isset($ingredientBasetypes)):?>
            <?foreach($ingredientBasetypes->result() as $result):?>
                <span class="listboxItem" value="<?=$result->basetype_id?>">
                    <label class="listboxItemLabel"><?=$result->basetype_title?></label>
                    <a onclick="listboxRemoveItem(this)" class="listboxItemClose"></a>
                </span>
            <?endforeach;?>
        <?endif;?>
    </div>

    <div class="warning_section"></div>
</div>

<div id="button_section" class="form_section">
<input type="button" class="button" value="Save" id="save_ingredient"/>
<input type="button" value="Cancel" class="button" id="cancel_ingredient"/>
</div>